package com.bush.mall.order.controller;

import org.springframework.web.bind.annotation.*;
import com.bush.mall.common.entity.Result;;
import com.bush.mall.order.entity.OrderReturnApplyEntity;
import com.bush.mall.order.service.OrderReturnApplyService;
import javax.annotation.Resource;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * 订单退货申请
 * @author RUN
 * @date 2022-11-29
 */
@RestController
@RequestMapping("orderreturnapply")
@Api(tags = "订单退货申请管理" )
public class OrderReturnApplyController {

    @Resource(name= OrderReturnApplyService.BEAN_ID)
    private OrderReturnApplyService orderReturnApplyService;

    /**
     * 分页查询订单退货申请列表
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "分页查询订单退货申请列表")
    @GetMapping("queryForPage")
    public Result queryForPage(Integer current,Integer size){
        return orderReturnApplyService.queryForPage(current,size);
    }

    /**
     * 保存订单退货申请表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "保存订单退货申请表单")
    @PostMapping
    public Result saveOrderReturnApply(@RequestBody OrderReturnApplyEntity orderReturnApply){
        return orderReturnApplyService.saveOrderReturnApply(orderReturnApply);
    }

    /**
     * 修改订单退货申请表单
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "修改订单退货申请表单")
    @PutMapping
    public Result updateOrderReturnApply(@RequestBody OrderReturnApplyEntity orderReturnApply){
        return orderReturnApplyService.updateOrderReturnApply(orderReturnApply);
    }

    /**
     * 通过指定id删除订单退货申请
     * @author RUN
     * @date 2022-11-29
     */
    @ApiOperation(value = "通过指定id删除订单退货申请")
    @DeleteMapping
    public Result deleteOrderReturnApply(Long id){
        return orderReturnApplyService.deleteOrderReturnApply(id);
    }

}
